﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using nspJob;

public partial class job_PositionList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.Cookies["uName"] == null)
            {
                Response.Write("<script>location.assign('Index.aspx');</script>");
            }
            else
            {
                Bind();
            }
        }
    }
    public void Bind()
    {
        DataTable tb =new DataTable();
        string strURl = Request.RawUrl;
        strURl = strURl.Substring(0, strURl.IndexOf(".aspx")) + ".aspx";
        PageNo1.Strurl = strURl;
        PageNo1.FldName = "AddDate";
        PageNo1.Table = " (C_JobResume left join  "+
                        "(select C_Job.ID,C_Job.Position,CompanyName,LoginName,count from C_Job  "+
		                "left join U_UserInfo on U_UserInfo.UserID=C_Job.UserID)job on C_JobResume.jobID=job.ID)";
        PageNo1.StrGetFields = " count,AddDate,position,CompanyName,LoginName ";
        PageNo1.PageSize = 12;
        try
        {
            if (Request.Cookies["Resumeid"] != null)
            {
                PageNo1.Where = " C_JobResume.ResumeID=" + Request.Cookies["Resumeid"].Value + "";
                tb = PageNo1.BindViewDesc();
                if (tb.Rows.Count != 0)
                {
                    this.grdJob.DataSource = tb;
                    this.grdJob.DataBind();
                }
                else
                {
                    this.grdJob.DataSource = null;
                    this.grdJob.DataBind();
                }
            }
            else
            {
                this.grdJob.DataSource = null;
                this.grdJob.DataBind();
            }
        }
        catch (Exception exception)
        {
            this.grdJob.DataSource = null;
            this.grdJob.DataBind();
        }

    }
    public string GetShortDate(string dateStr)
    {
        if (dateStr != string.Empty)
            return Convert.ToDateTime(dateStr).ToShortDateString();
        else
            return String.Empty;
    }

}
